/*
 * frmMantenerTratamiento2.java
 *
 * Created on 30/08/2011, 01:59:25 AM
    Programador         :   Diego Alvarado / Bruno Alvarado
    Descripcion         :   Formulario de mantenimiento de Diagnosticos (Registro,Modificar,Eliminar,Consulta)
    Última modificación :   

 */

package pe.sonrisas.tools.view;

import Complementos.Conexion_BD;
import Complementos.Validar;
import Complementos.Visual;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

public class frmMantenerTratamiento2 extends javax.swing.JDialog {

   /** Crear variables/campos/atributos de clase */

    private String viejombre;
    private int idTratamiento;
       
    
    

    public String getViejombre() {
        return viejombre;
    }

    public void setViejombre(String viejombre) {
        this.viejombre = viejombre;
    }

    public frmMantenerTratamiento2(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        txtNombre.requestFocus();
       
    }

    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tbpaneMantenerTratamientos = new javax.swing.JTabbedPane();
        panelRegistrarTratamiento = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtDescripcion = new javax.swing.JTextArea();
        btnAgregar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnActualizar = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        txtCosto = new javax.swing.JTextField();
        panelVerTratamientos = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        btnEditar = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblTratamientos = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("..::  Sonrisas Tools :..    Tratamientos");
        setPreferredSize(new java.awt.Dimension(580, 500));

        tbpaneMantenerTratamientos.setBackground(new java.awt.Color(204, 204, 240));
        tbpaneMantenerTratamientos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbpaneMantenerTratamientosMouseClicked(evt);
            }
        });
        tbpaneMantenerTratamientos.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                tbpaneMantenerTratamientosAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        panelRegistrarTratamiento.setBackground(new java.awt.Color(204, 204, 240));
        panelRegistrarTratamiento.setPreferredSize(new java.awt.Dimension(607, 450));

        jLabel1.setText("Tratamiento:");

        txtNombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtNombreKeyPressed(evt);
            }
        });

        jLabel2.setText("Descripción:");

        txtDescripcion.setColumns(20);
        txtDescripcion.setRows(5);
        jScrollPane1.setViewportView(txtDescripcion);

        btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pe/sonrisas/tools/imagenes/comun/check.png"))); // NOI18N
        btnAgregar.setText("Agregar");
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pe/sonrisas/tools/imagenes/comun/cancel.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        btnActualizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pe/sonrisas/tools/imagenes/comun/update.png"))); // NOI18N
        btnActualizar.setText("Actualizar");
        btnActualizar.setEnabled(false);
        btnActualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnActualizarActionPerformed(evt);
            }
        });

        jLabel3.setText("Costo:");

        javax.swing.GroupLayout panelRegistrarTratamientoLayout = new javax.swing.GroupLayout(panelRegistrarTratamiento);
        panelRegistrarTratamiento.setLayout(panelRegistrarTratamientoLayout);
        panelRegistrarTratamientoLayout.setHorizontalGroup(
            panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRegistrarTratamientoLayout.createSequentialGroup()
                .addGap(76, 76, 76)
                .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRegistrarTratamientoLayout.createSequentialGroup()
                        .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(txtNombre, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE))
                        .addGap(257, 257, 257))
                    .addGroup(panelRegistrarTratamientoLayout.createSequentialGroup()
                        .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCosto, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(panelRegistrarTratamientoLayout.createSequentialGroup()
                                .addComponent(btnAgregar)
                                .addGap(18, 18, 18)
                                .addComponent(btnActualizar)
                                .addGap(18, 18, 18)
                                .addComponent(btnCancelar)))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        panelRegistrarTratamientoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnActualizar, btnAgregar, btnCancelar});

        panelRegistrarTratamientoLayout.setVerticalGroup(
            panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelRegistrarTratamientoLayout.createSequentialGroup()
                .addGap(44, 44, 44)
                .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(26, 26, 26)
                .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCosto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelRegistrarTratamientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAgregar)
                    .addComponent(btnActualizar)
                    .addComponent(btnCancelar))
                .addContainerGap(160, Short.MAX_VALUE))
        );

        panelRegistrarTratamientoLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btnActualizar, btnAgregar, btnCancelar});

        tbpaneMantenerTratamientos.addTab("Registrar tratamiento", panelRegistrarTratamiento);

        panelVerTratamientos.setBackground(new java.awt.Color(204, 204, 240));

        jToolBar1.setBackground(new java.awt.Color(204, 204, 240));
        jToolBar1.setRollover(true);

        btnEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pe/sonrisas/tools/imagenes/comun/edit_reserva.png"))); // NOI18N
        btnEditar.setText("Editar");
        btnEditar.setFocusable(false);
        btnEditar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnEditar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditarActionPerformed(evt);
            }
        });
        jToolBar1.add(btnEditar);

        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/pe/sonrisas/tools/imagenes/comun/cancel_reserva.png"))); // NOI18N
        btnEliminar.setText("Eliminar");
        btnEliminar.setFocusable(false);
        btnEliminar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnEliminar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });
        jToolBar1.add(btnEliminar);

        tblTratamientos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Id", "Tratamiento", "Descripción", "Costo"
            }
        ));
        jScrollPane3.setViewportView(tblTratamientos);

        javax.swing.GroupLayout panelVerTratamientosLayout = new javax.swing.GroupLayout(panelVerTratamientos);
        panelVerTratamientos.setLayout(panelVerTratamientosLayout);
        panelVerTratamientosLayout.setHorizontalGroup(
            panelVerTratamientosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelVerTratamientosLayout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(panelVerTratamientosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE))
                .addGap(108, 108, 108))
        );
        panelVerTratamientosLayout.setVerticalGroup(
            panelVerTratamientosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelVerTratamientosLayout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(40, 40, 40)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(194, Short.MAX_VALUE))
        );

        tbpaneMantenerTratamientos.addTab("Ver tratamientos", panelVerTratamientos);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tbpaneMantenerTratamientos, javax.swing.GroupLayout.PREFERRED_SIZE, 580, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tbpaneMantenerTratamientos, javax.swing.GroupLayout.PREFERRED_SIZE, 450, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
        
        try {
            Conexion_BD conexion = new Conexion_BD();
            conexion.Conectar();
                                  
            String nombre = txtNombre.getText();
            String descripcion = txtDescripcion.getText();
            String costo = txtCosto.getText();
            
            if(nombre.equals("") || descripcion.equals("") || costo.equals("")){
                JOptionPane.showMessageDialog(this, "Debe completar los campos para agregar un tratamiento");
               // btnAgregar.setEnabled(false);
                
            }
            else{
            
            conexion.insupdel("insert into tratamiento (nombre, descripcion, costo) values ('"+nombre+"', '"+descripcion+"', "+costo+")");
            
            JOptionPane.showMessageDialog(this, "Se ha registrado el tratamiento correctamente");
            
            txtNombre.setText("");
            txtDescripcion.setText("");
            txtCosto.setText("");
            
            }
            
            try {
                conexion.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        
    }//GEN-LAST:event_btnAgregarActionPerformed

    private void txtNombreKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNombreKeyPressed
    if (evt.getKeyCode() == evt.VK_ENTER){
        Validar validar=new Validar();
        if (validar.esVacio(txtNombre.getText())){
            JOptionPane.showMessageDialog(this, "Por favor ingrese un nombre al tratamiento", "Error", JOptionPane.ERROR_MESSAGE);
            txtNombre.requestFocus();
        }else{
            txtDescripcion.requestFocus();
        }                                        }
    }//GEN-LAST:event_txtNombreKeyPressed

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
       int opcion = tblTratamientos.getSelectedRow();
       
       if(opcion != -1){
        
        try {
            //Recuperar la fila seleccionada
            //tblTratamientos.getValueAt(fila, columna);
    
           
            int respuesta = JOptionPane.showConfirmDialog(this, "¿Desea eliminar realmente este tratamiento?"); 
            
            if (respuesta == 0){
                Conexion_BD conexion = new Conexion_BD();
                conexion.Conectar();
            
                int id = Integer.parseInt(tblTratamientos.getValueAt(tblTratamientos.getSelectedRow(),0).toString());
    
                conexion.insupdel("UPDATE tratamiento SET activoTratamiento = 0 WHERE idTratamiento ="+id);
            
                limpiarTabla();
                cargarTablaTratamiento();
            
                JOptionPane.showMessageDialog(this, "Se ha eliminado el tratamiento correctamente");
                           
                try {
                
                    conexion.Desconectar();
                
                } catch (Exception ex) {
                    Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
        }
       }else{
          JOptionPane.showMessageDialog(this, "Seleccione el tratamiento que desea eliminar");
       }
           
        
        
        
    }//GEN-LAST:event_btnEliminarActionPerformed

    private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed
            
            //Obtenemos el numero de fila seleccionadaÇ)0
            int fila = tblTratamientos.getSelectedRow();
            
            if(fila != -1 ){
            
            
            //Obtenemos los datos de la tabla
            idTratamiento       = Integer.parseInt(tblTratamientos.getValueAt(fila, 0).toString());
            String nombre       = tblTratamientos.getValueAt(fila, 1).toString();
            String descripcion  = tblTratamientos.getValueAt(fila, 2).toString();
            String costo        = tblTratamientos.getValueAt(fila, 3).toString();
            
            // Le decimos al tabbedPane que seleccione la primer pestaña
            tbpaneMantenerTratamientos.setSelectedIndex(0);
            
            //Pasamos los datos a las cajas de texto
            txtNombre.setText(nombre);
            txtDescripcion.setText(descripcion);
            txtCosto.setText(costo);
            
            //Habilitar el botón de actualizar
            btnActualizar.setEnabled(true);
            btnAgregar.setEnabled(false);
            }
            else{
                JOptionPane.showMessageDialog(this, "Seleccione el tratamiento que desea editar");
            }
   
    }//GEN-LAST:event_btnEditarActionPerformed

    private void tbpaneMantenerTratamientosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbpaneMantenerTratamientosMouseClicked
        
        limpiarTabla();
        cargarTablaTratamiento();         
                       
        
    }//GEN-LAST:event_tbpaneMantenerTratamientosMouseClicked

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
        if (btnAgregar.getText().equals("Modificar")){
           tbpaneMantenerTratamientos.setSelectedIndex(1);
           txtNombre.setText("");
           txtDescripcion.setText("");
        }
        else{
        dispose();    //para cerrar la ventana

        }
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void btnActualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnActualizarActionPerformed
        try {
            Conexion_BD con = new Conexion_BD();
            con.Conectar();
                  
                      
            String nombre      = txtNombre.getText();
            String descripcion = txtDescripcion.getText();
            String costo       = txtCosto.getText();
            
            con.insupdel("update tratamiento set nombre='"+nombre+"' , descripcion='"+descripcion+"', costo="+costo+" where idTratamiento="+idTratamiento);
            
                                  
            JOptionPane.showMessageDialog(this, "SE ACTUALIZO CORRECTAMENTE");
            
            txtNombre.setText("");
            txtDescripcion.setText("");
            txtCosto.setText("");
            
            btnAgregar.setEnabled(true);
            btnActualizar.setEnabled(false);
            
            tbpaneMantenerTratamientos.setSelectedIndex(1);
            limpiarTabla();
            cargarTablaTratamiento();
            
            
            
            try {
                con.Desconectar();
            } catch (Exception ex) {
                Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmMantenerTratamiento2.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnActualizarActionPerformed

    private void tbpaneMantenerTratamientosAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_tbpaneMantenerTratamientosAncestorAdded
            
            limpiarTabla();
            cargarTablaTratamiento();
    }//GEN-LAST:event_tbpaneMantenerTratamientosAncestorAdded


    public void limpiarTabla(){
        for (int i = 0; i < tblTratamientos.getRowCount(); i++) {
            tblTratamientos.setValueAt("", i, 0);
            tblTratamientos.setValueAt("", i, 1);
            tblTratamientos.setValueAt("", i, 2);
            tblTratamientos.setValueAt("", i, 3);
            
        }
    }


    public void limpiarPanelRegistrar(){
            txtNombre.setText("");
            txtDescripcion.setText("");
            txtNombre.requestFocus();
    }
    
    
    public void cargarTablaTratamiento() {
        try {
            Conexion_BD conexion = new Conexion_BD();
            ResultSet rs = null;
            conexion.Conectar();
            
            rs = conexion.Consultar("SELECT idTratamiento,nombre,descripcion,costo FROM tratamiento WHERE activoTratamiento = 1");
            
            int fila = 0;
            while(rs.next()){
                
                // PARAMETROS (dato a ingresar, fila, y columna)
                // Columna se inicia en 0
            tblTratamientos.setValueAt(rs.getString(1), fila, 0);
            tblTratamientos.setValueAt(rs.getString(2), fila, 1);
            tblTratamientos.setValueAt(rs.getString(3), fila, 2);
            tblTratamientos.setValueAt(rs.getString(4), fila, 3);
            fila++;
            }   
                    
            conexion.Desconectar();
            rs.close();
            
        } catch (Exception ex) {
           JOptionPane.showMessageDialog(this, ex.getMessage());
        }
  
    } 
      
    
    
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Visual.aspectoMac();
                frmMantenerTratamiento2 dialog = new frmMantenerTratamiento2(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnActualizar;
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnEditar;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JPanel panelRegistrarTratamiento;
    private javax.swing.JPanel panelVerTratamientos;
    private javax.swing.JTable tblTratamientos;
    private javax.swing.JTabbedPane tbpaneMantenerTratamientos;
    private javax.swing.JTextField txtCosto;
    private javax.swing.JTextArea txtDescripcion;
    private javax.swing.JTextField txtNombre;
    // End of variables declaration//GEN-END:variables

    

}
